import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/index.css'
import './assets/fonts/iconfont'
import TreeTable from 'vue-table-with-tree-grid' //第三方表格内嵌树状
import VueQuillEditor from 'vue-quill-editor' //富编辑器
import NProgress from 'nprogress' //网络访问进度条
import 'nprogress/nprogress.css'

import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme

Vue.use(VueQuillEditor /* { default global options } */)

Vue.use(TreeTable)
Vue.component('tree-table', TreeTable) //全局使用

Vue.config.productionTip = false

import axios from 'axios'
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
// 设置请求头中添加Authorization字段，值为用户登录时的token值
axios.interceptors.request.use((config) => {
  NProgress.start() //开始进度条
  config.headers.Authorization = window.sessionStorage.token
  // console.log(config)
  // 必须要return
  return config
})
axios.interceptors.response.use((config) => {
  NProgress.done() //结束进度条
  return config
})

Vue.prototype.$http = axios

new Vue({
  router,
  render: (h) => h(App),
}).$mount('#app')
